package net.gyapp.markim.core.reponse;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import net.gyapp.markim.module.contact.adapter.ContactAdapter;

import org.jim.common.packets.Command;

import java.io.Serializable;
import java.util.List;

/**
 * Auther:  winds
 * Email:   heardown@163.com
 * Date:    2018/7/16.
 * Desc:    登录后响应  返回联系人信息
 */

public class LoginResponse extends ImResponse implements Serializable {
    public int code;
    public int command;
    public DataBean data;
    public String msg;

    @Override
    public Command getCommand() {
        return Command.valueOf(command);
    }

    public static class DataBean implements Serializable {
        public UserBean user;

        public static class UserBean implements Serializable {
            public String avatar;
            public String id;
            public String nick;
            public String terminal;
            public List<FriendsBean> friends;
            public List<GroupsBean> groups;

            @Override
            public String toString() {
                return "UserBean{" +
                        "avatar='" + avatar + '\'' +
                        ", id='" + id + '\'' +
                        ", nick='" + nick + '\'' +
                        ", terminal='" + terminal + '\'' +
                        ", friends=" + friends +
                        ", groups=" + groups +
                        '}';
            }

            public static class FriendsBean implements Serializable {
                public String group_id;
                public String name;
                public List<UserChildBean> users;

                @Override
                public String toString() {
                    return "FriendsBean{" +
                            "group_id='" + group_id + '\'' +
                            ", name='" + name + '\'' +
                            ", users=" + users +
                            '}';
                }
            }

            public static class GroupsBean implements MultiItemEntity, Serializable {
                public String group_id;
                public String name;
                public String avatar;
                public List<UserChildBean> users;

                @Override
                public int getItemType() {
                    return ContactAdapter.TYPE_CONTACT_GROUP;
                }

                @Override
                public String toString() {
                    return "GroupsBean{" +
                            "group_id='" + group_id + '\'' +
                            ", name='" + name + '\'' +
                            ", users=" + users +
                            '}';
                }
            }

            public static class UserChildBean implements MultiItemEntity, Serializable {
                public String avatar;
                public String id;
                public String nick;

                @Override
                public int getItemType() {
                    return ContactAdapter.TYPE_CONTACT_USER;
                }

                @Override
                public String toString() {
                    return "UserChildBean{" +
                            "avatar='" + avatar + '\'' +
                            ", id='" + id + '\'' +
                            ", nick='" + nick + '\'' +
                            '}';
                }
            }
        }

        @Override
        public String toString() {
            return "DataBean{" +
                    "user=" + user +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "LoginResponse{" +
                "code=" + code +
                ", command=" + command +
                ", data=" + data +
                ", msg='" + msg + '\'' +
                '}';
    }

}
